# Maintainer: Kreijstal <kreijstal@hotmail.com>

_realname=qucs-s
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=25.1.0
pkgrel=1
pkgdesc="A spin-off of Qucs that supports other free SPICE circuit simulators like ngspice with the same Qucs GUI"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url='https://ra3xdh.github.io/'
msys2_repository_url='https://github.com/ra3xdh/qucs_s'
license=('spdx:gpl-2.0')
groups=("${MINGW_PACKAGE_PREFIX}-eda")
depends=(
  "${MINGW_PACKAGE_PREFIX}-qt6-base"
  "${MINGW_PACKAGE_PREFIX}-gcc-libs"
  "${MINGW_PACKAGE_PREFIX}-ngspice"
  "${MINGW_PACKAGE_PREFIX}-qt6-svg"
  "${MINGW_PACKAGE_PREFIX}-qt6-charts"

)
makedepends=(
  "${MINGW_PACKAGE_PREFIX}-cc"
  "${MINGW_PACKAGE_PREFIX}-cmake"
  "${MINGW_PACKAGE_PREFIX}-ninja"
  "${MINGW_PACKAGE_PREFIX}-qt6-tools"
  "${MINGW_PACKAGE_PREFIX}-python"
  "${MINGW_PACKAGE_PREFIX}-gperf"
)
source=(
  "https://github.com/ra3xdh/qucs_s/releases/download/${pkgver}/${_realname}-${pkgver}.tar.gz"
)
sha256sums=('66fcbaf56cec741ed7f5d60491a1ffafcc1fb5d96485df8319012d2c66a11fee')

build() {
  cd "${srcdir}/${_realname}-${pkgver}"
  mkdir -p build-${MSYSTEM} && cd build-${MSYSTEM}

  MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
    cmake \
    -GNinja \
    -DCMAKE_INSTALL_PREFIX="${MINGW_PREFIX}" \
    -DCMAKE_BUILD_TYPE="Release" \
    -DCI_VERSION="${pkgver}" \
    ..

  cmake --build .
}


package() {
  cd "${srcdir}/${_realname}-${pkgver}/build-${MSYSTEM}"
  DESTDIR="${pkgdir}" cmake --install .
}
